{include file="public/head"}
<style>
    .zfpassword{
        margin: 1rem;
    }
    .zfpassword input{
        border: 1px solid #000;
        border-radius:3px;
        padding: .5rem 0;
        width: 100%;
    }
</style>
<body>

<header class="aui-header-default aui-header-fixed aui-header-bg">
    <a href="{:url('Order/OrderList')}" class="aui-header-item">
        <i class="aui-icon aui-icon-back-white"></i>
    </a>
    <div class="aui-header-center aui-header-center-clear">
        <div class="aui-header-center-logo">
            <div class="aui-car-white-Typeface" style="color:black;font-weight: bold;">收银台</div>
        </div>
    </div>
    <a href="#" class="aui-header-item-icon"   style="min-width:0">
<!--        <i class="aui-icon aui-icon-member"></i>-->
    </a>
</header>

<section class="aui-settle-content">
    <div class="aui-settle-title">
        <p>需支付:    <span id="pay_money">{$OrderInfo.amount}元</span></p>
    </div>
<!--    <div class="aui-settle-pay">-->
<!--        <img src="__STATIC__/User/img/icon/pay.png" alt="">-->
<!--    </div>-->
    <div class="aui-dri"></div>
    <div class="aui-settle-choice">
        <div class="aui-settle-ways">
            选择支付方式
        </div>
        {if condition="$OrderInfo.order_type eq 1"}
        <a href="javascript:" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/reward.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                积分支付
                <p>积分({$UserInfo.balance_1})</p>
               
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="1" class="check check-pay goods-check goodsCheck"checked="checked"></div>
        </a>
        <a href="javascript:" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/reward.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                积分+余额支付
                <p>积分({$UserInfo.balance_1})</p>
                <p>余额({$UserInfo.balance_4})</p>

            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="2" class="check check-pay goods-check goodsCheck"checked="checked"></div>
        </a>
        {else/}
        <!--<a href="#" class="aui-address-cell  aui-fl-arrow-clear">-->
        <!--    <div class="aui-address-cell-hd">-->
        <!--        <img src="__STATIC__/User/img/icon/shares.png" alt="">-->
        <!--    </div>-->
        <!--    <div class="aui-address-cell-bd">-->
        <!--        积分+余额支付-->
        <!--        <p>积分(￥{$UserInfo.balance_1} 余额{$UserInfo.balance_4})</p>-->
        <!--    </div>-->
        <!--    <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="2" class="check check-pay goods-check goodsCheck"></div>-->
        <!--</a>-->
        
        <a href="javascript:" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/reward.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                余额支付
                <p>余额({$UserInfo.balance_4})</p>
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="3" class="check check-pay goods-check goodsCheck" checked="checked"></div>
        </a>
        <a href="javascript:" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/reward.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                微信支付
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="9" class="check check-pay goods-check goodsCheck" ></div>
        </a>
{/if}
        <!--{if condition="$OrderInfo.pay_point gt 0"}-->
        <!--<a href="#" class="aui-address-cell  aui-fl-arrow-clear">-->
            <!--<div class="aui-address-cell-hd">-->
                <!--<img src="__STATIC__/User/img/icon/shares.png" alt="">-->
            <!--</div>-->
            <!--<div class="aui-address-cell-bd">-->
                <!--奖金+炁点支付-->
                <!--<p>奖金余额(￥{$UserInfo.balance_1} 炁点余额{$UserInfo.balance_2})</p>-->
            <!--</div>-->
            <!--<div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="2" class="check check-pay goods-check goodsCheck"></div>-->
        <!--</a>-->

        <!--<a href="#" class="aui-address-cell  aui-fl-arrow-clear">-->
            <!--<div class="aui-address-cell-hd">-->
                <!--<img src="__STATIC__/User/img/icon/shares.png" alt="">-->
            <!--</div>-->
            <!--<div class="aui-address-cell-bd">-->
                <!--电子钱包+炁点支付-->
                <!--<p>电子钱包余额(￥{$UserInfo.balance_4} 炁点余额{$UserInfo.balance_2})</p>-->
            <!--</div>-->
            <!--<div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="4" class="check check-pay goods-check goodsCheck"></div>-->
        <!--</a>-->
        <!--{/if}-->


    </div>
    
    
</section>
<div class="aui-settle-payment">
    <a href="javascript:" id="pay">立即支付</a>
</div>
<script type="text/javascript" src="__STATIC__/User/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/Admin/layer/layer.js"></script>

<script>
    $(function () {

        $("input[name='pay_type']").change(function() {

            var pay_type = $("input[name='pay_type']:checked").val();
            if(pay_type == 1){
                $("#pay_money").text('{$OrderInfo.amount}'+'积分');
            }
            if(pay_type == 2){
                var pay_amount = parseFloat("{$OrderInfo.amount}") - parseFloat("{$OrderInfo.pay_point}");
                $("#pay_money").text('共计'+'{$OrderInfo.amount}');
            }
            if(pay_type == 3){
                $("#pay_money").text('{$OrderInfo.amount}'+'元');
            }
            if(pay_type == 4){
                var pay_amount = parseFloat("{$OrderInfo.amount}") - parseFloat("{$OrderInfo.pay_point}");
                $("#pay_money").text(pay_amount+'分 '+"{$OrderInfo.pay_point}积分");
            }
        })

        $("#pay").on('click',function () {
            var pay_type = $("input[name='pay_type']:checked").val();
            var post_type = $("input[name='post_type']:checked").val();
            var order_id = "{$OrderInfo.order_id}";
            if(pay_type == 9){
                window.location.href = "{:url('OrderWeChatGZPay')}?order_id="+order_id+"&post_type="+post_type;
                return false;
            }
            layer.open({
                type: 1,
                title: '请输入支付密码',
                area: ["80%", "9.5rem"],
                closeBtn: 1,
                // skin: 'layui-layer-lan'
                content: '<div class="zfpassword"><input type="password" id="paypassword" placeholder="请输入支付密码" style="padding:  .2rem .5rem"></div>',
                btn: ['确定', '取消'],
                yes: function () {
                    var password = document.getElementById('paypassword');
                    $.ajax({
                        type: "POST",
                        url: "{:url('Order/OrderPay')}",
                        data: {
                            pay_type:pay_type,
                            order_id:order_id,
                            password:password.value,
                            post_type:1,//此字段无用了
                        },
                        dataType: "json",
                        success: function (data) {
                            if (data.status == 1) {
                                alert(data.message);
                                window.location.href="{:url('Order/OrderList')}";
                            } else {
                                alert(data.message);
                            }
                        }
                    })
                }
            })
        })
    })
</script>
</body>
</html>